﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication1.DDD.Web.Default.users
{
    public class editAction  : Controller
	{
		public editAction(System.IO.TextWriter tw):base(tw){}
		public editAction(string fileName) : base(fileName) {}
		#if (!AspNET && !MicrosoftOwin && !NFinalOwin)
		public editAction(HttpContext context):base(context){}
		public editAction(Microsoft.Owin.IOwinContext context):base(context){}
		public editAction(NFinal.Owin.HtmlWriter writer,NFinal.Owin.Request request):base(writer,request){}
		#endif
		#if AspNET
		public editAction(HttpContext context):base(context){}
		#endif
		#if MicrosoftOwin
		public editAction(Microsoft.Owin.IOwinContext context):base(context){}
		#endif
		#if NFinalOwin
		public editAction(NFinal.Owin.HtmlWriter writer,NFinal.Owin.Request request):base(writer,request){}
		#endif
		public editAction(Controller controller):base(controller){}
        
        public void edit(int id,string name,string pwd)
        {
            var con = new System.Data.SQLite.SQLiteConnection(NFinal.Config.ConfigurationManager.ConnectionStrings["Common"].ConnectionString);
			con.Open();
            #region	var count; 更新表,并返回受影响行数
			var __edit_count_command__ = new System.Data.SQLite.SQLiteCommand("update users set name=@name,pwd=@pwd where id=@id;", con);
			var __edit_count_parameters__=new System.Data.SQLite.SQLiteParameter[3];
					__edit_count_parameters__[0] = new System.Data.SQLite.SQLiteParameter("@name",System.Data.DbType.String);
					__edit_count_parameters__[0].Value = name;
					__edit_count_parameters__[1] = new System.Data.SQLite.SQLiteParameter("@pwd",System.Data.DbType.String);
					__edit_count_parameters__[1].Value = pwd;
					__edit_count_parameters__[2] = new System.Data.SQLite.SQLiteParameter("@id",System.Data.DbType.Int64);
					__edit_count_parameters__[2].Value = id;
			__edit_count_command__.Parameters.AddRange(__edit_count_parameters__);
				var count = __edit_count_command__.ExecuteNonQuery();
			__edit_count_command__.Dispose();
			#endregion
			
            con.Close();
            AjaxReturn(count > 0);
        }
        
        
    }
}